import React from 'react';
import { BrowserRouter as RouterWrap,  Switch, Route} from 'react-router-dom';
// 路由拦截处理
import Permission from './permission'
// 首页
import APP from '../pages/App';
// 测试页面 ~ 1
import TEST1 from '../pages/Test1/Test1';
// 测试页面 ~ 2
import TEST2 from '../pages/Test2/Test2';
// 测试页面 ~ 3
import TEST3 from '../pages/Test3/Test3';

/**
 * route 
 * @param {String}  path => 路由路径
 * @param {String}  name => 路由名称
 * @param {Object}  component => 当前路由组件
 * @param {Boolean} authorization => 是否需要权限检验
 */
const route = [
    { path: '/',      name: 'APP',   component: APP,    authorization: true },
    { path: '/test1', name: 'TEST1', component: TEST1,  authorization: true },
    { path: '/test2', name: 'TEST2', component: TEST2,  authorization: true },
    { path: '/test3', name: 'TEST3', component: TEST3,  authorization: true }
]


export default class Router extends React.Component{
    render(){
        return(
            <RouterWrap>
                <Switch>
                    <Permission routerConfig={route}></Permission>
                </Switch>
            </RouterWrap>
        )
    }
}